package com.accp.action;

import java.util.List;

import javax.annotation.Resource;

import com.accp.biz.CarsBiz;
import com.accp.entity.CarBrand;
import com.accp.entity.Cars;


public class CarsAction {
	@Resource
	private CarsBiz carsBiz;
	
	private List<Cars> cars;
	private List<CarBrand>  brands;
	private Cars car;
	private int cid;
	
	
	
	public List<Cars> getCars() {
		return cars;
	}
	public void setCars(List<Cars> cars) {
		this.cars = cars;
	}
	public List<CarBrand> getBrands() {
		return brands;
	}
	public void setBrands(List<CarBrand> brands) {
		this.brands = brands;
	}
	public Cars getCar() {
		return car;
	}
	public void setCar(Cars car) {
		this.car = car;
	}
	public int getCid() {
		return cid;
	}
	public void setCid(int cid) {
		this.cid = cid;
	}
	/*
	 * 查询车辆表
	 */
	public String queryCars(){
		cars=carsBiz.queryCars();
		brands=carsBiz.queryBrand();
		return "success";
	}
	/*
	 * 添加车辆
	 */
	public String addCar(){
		carsBiz.addCar(car);
		return  queryCars();
	}
	/*
	 * 删除车辆
	 */
	public String delCar(){
		carsBiz.delCar(cid);
		return  queryCars();
	}
	/*
	 * 修改之前先进行查询单个
	 */
	public String queryCar(){
		car=carsBiz.queryCar(cid);
		return queryCars();
	}
	/*
	 * 修改车辆信息
	 */
	public String updateCar(){
		carsBiz.updateCar(car);
		return  queryCars();
	}
	
	
}
